﻿using System;
using System.Threading;
using System.Collections.Generic;
//using System.Linq;
using System.Text;

namespace edu.und.crc.clients.chemistry.macrodox
{
    class Macrodox
    {
        Sbir sbir1 = new Sbir();
        Sbir sbir2 = new Sbir();
        static void Main(string[] args)
        {
            Macrodox mdx = new Macrodox(args);
        }

        public Macrodox(string[] args)
        {
            this.sbir1.initData(7500);
            this.sbir2.initData(7500);
            Console.WriteLine("**********************************************");
            Console.WriteLine("*  Welcome to MacroDox C#                    *");
            Console.WriteLine("*  ------------------------------------      *");
            Console.WriteLine("*  Written in Fortran 77 by:                 *");
            Console.WriteLine("*  Dr. Scott Northrup                        *");
            Console.WriteLine("*  snorthrup@tntech.edu                      *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  Dept. of Chemistry                        *");
            Console.WriteLine("*  Tennessee Technological University        *");
            Console.WriteLine("*  Cookeville, TN 38505                      *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  MacroDox Fortran77 Web Site:              *");
            Console.WriteLine("*  http://pirn.chem.tntech.edu/macrodox.html *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  ------------------------------------      *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  Press 'Enter' to continue...              *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("**********************************************");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("**********************************************");
            Console.WriteLine("*  Ported to C# by:                          *");
            Console.WriteLine("*  Aaron Bergstrom                           *");
            Console.WriteLine("*  aaron.bergstrom@und.edu                   *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  Computational Research Center             *");
            Console.WriteLine("*  University of North Dakota                *");
            Console.WriteLine("*  Grand Forks, ND 58202-9041                *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  MacroDox C# Web Site:                     *");
            Console.WriteLine("*  http://sourceforge.net/projects/mdxcs     *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  ------------------------------------      *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("*  Press 'Enter' to continue...              *");
            Console.WriteLine("*                                            *");
            Console.WriteLine("**********************************************");
            Console.ReadLine();
            Console.Clear();
            while (true) this.input();
        }

        public void input()
        {
            Console.WriteLine("Main Menu\nAvailable Tasks: [ Mutate | Exit ]");
            Console.Write("\nEnter Task > ");
            String val = Console.ReadLine();
            val = val.Trim();
            if (val.ToLower().Equals("exit"))
            {
                Console.Clear();
                Console.Write("\n                    Exiting MacroDox");
                for (int i = 0; i < 10; i++)
                {
                    Thread.Sleep(200);
                    Console.Write(".");
                }
                Thread.Sleep(500);
                Environment.Exit(0);
            }
            else if (val.ToLower().Equals("mutate"))
            {
                Mutate.beginMutation(ref this.sbir1);
                Console.Clear();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Macrodox did not understand your input:");
                Console.WriteLine(val + "\n");
                Console.WriteLine("Press the 'Enter' key to continue...");
                Console.ReadLine();
                Console.Clear();
            }
        }

        ~Macrodox()
        {
        }
    }
}
